﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EntityComponentSystem.Framework;
using EntityComponentSystem.Framework.Json;

namespace ECS.Demos.Tetris.Components
{    
    public class BlockShapeHelper
    {
        public Component Component { get; protected set; }
        public int Width { get; private set; }

        public BlockShapeHelper(Component com, int w)
        {
            this.Component = com;
            this.Width = w;
        }

        public int this[int x, int y]
        {
            get
            {
                JsonArray data = (JsonArray)Component["data"];

                var index = y * Width + x;
                return data[index];
            }
        }       
    }
}
